package o;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import o.el.c;
import o.eo.a;

public class ek extends ew {
    int ʻˊ;
    protected ea ʻˋ = new ea();
    int ʻᐝ;
    int ʼˊ;
    int ʼˋ;
    int ʼᐝ = 0;
    em[] ʽˊ = new em[4];
    int ʽˋ = 0;
    public List<es> ʽᐝ = new ArrayList();
    em[] ʾॱ = new em[4];
    public boolean ʿॱ = false;
    public boolean ˈॱ = false;
    public int ˉॱ = 0;
    public boolean ˊʻ = false;
    public int ˊʼ = 0;
    int ˊʽ = 0;
    private boolean ˋʻ = false;
    public boolean ˋʼ = false;
    private ey ˋʽ;
    private boolean ˎͺ = false;
    private boolean ˑॱ = false;
    private int ͺˎ = 7;

    public void ˊ(int i) {
        this.ͺˎ = i;
    }

    public int ˋ() {
        return this.ͺˎ;
    }

    public boolean ʼॱ(int i) {
        return (this.ͺˎ & i) == i;
    }

    public void ʽ() {
        this.ʻˋ.ॱ();
        this.ʻᐝ = 0;
        this.ʼˊ = 0;
        this.ʼˋ = 0;
        this.ʻˊ = 0;
        this.ʽᐝ.clear();
        this.ˋʼ = false;
        super.ʽ();
    }

    public boolean ˑ() {
        return this.ˑॱ;
    }

    public boolean ˎˏ() {
        return this.ˎͺ;
    }

    public boolean ˎ(ea eaVar) {
        ˏ(eaVar);
        int size = this.ˌॱ.size();
        for (int i = 0; i < size; i++) {
            el elVar = (el) this.ˌॱ.get(i);
            if (elVar instanceof ek) {
                c cVar = elVar.ˉ[0];
                c cVar2 = elVar.ˉ[1];
                if (cVar == c.WRAP_CONTENT) {
                    elVar.ˋ(c.FIXED);
                }
                if (cVar2 == c.WRAP_CONTENT) {
                    elVar.ˊ(c.FIXED);
                }
                elVar.ˏ(eaVar);
                if (cVar == c.WRAP_CONTENT) {
                    elVar.ˋ(cVar);
                }
                if (cVar2 == c.WRAP_CONTENT) {
                    elVar.ˊ(cVar2);
                }
            } else {
                eq.ˊ(this, eaVar, elVar);
                elVar.ˏ(eaVar);
            }
        }
        if (this.ʼᐝ > 0) {
            en.ˋ(this, eaVar, 0);
        }
        if (this.ʽˋ > 0) {
            en.ˋ(this, eaVar, 1);
        }
        return true;
    }

    public void ॱ(ea eaVar, boolean[] zArr) {
        zArr[2] = false;
        ˋ(eaVar);
        int size = this.ˌॱ.size();
        for (int i = 0; i < size; i++) {
            el elVar = (el) this.ˌॱ.get(i);
            elVar.ˋ(eaVar);
            if (elVar.ˉ[0] == c.MATCH_CONSTRAINT && elVar.ॱᐝ() < elVar.ॱˎ()) {
                zArr[2] = true;
            }
            if (elVar.ˉ[1] == c.MATCH_CONSTRAINT && elVar.ᐝॱ() < elVar.ॱˋ()) {
                zArr[2] = true;
            }
        }
    }

    public void ˏ(boolean z) {
        this.ˋʻ = z;
    }

    public boolean ͺॱ() {
        return this.ˋʻ;
    }

    public void ˋ(int i) {
        super.ˋ(i);
        int size = this.ˌॱ.size();
        for (int i2 = 0; i2 < size; i2++) {
            ((el) this.ˌॱ.get(i2)).ˋ(i);
        }
    }

    public void ˏˏ() {
        int i = this.ˌ;
        int i2 = this.ˎˏ;
        int max = Math.max(0, ॱᐝ());
        int max2 = Math.max(0, ᐝॱ());
        this.ˑॱ = false;
        this.ˎͺ = false;
        if (this.ˊˋ != null) {
            if (this.ˋʽ == null) {
                this.ˋʽ = new ey(this);
            }
            this.ˋʽ.ˎ(this);
            ʽ(this.ʻᐝ);
            ʼ(this.ʼˋ);
            ˎˎ();
            ॱ(this.ʻˋ.ᐝ());
        } else {
            this.ˌ = 0;
            this.ˎˏ = 0;
        }
        if (this.ͺˎ != 0) {
            if (!ʼॱ(8)) {
                ॱͺ();
            }
            if (!ʼॱ(32)) {
                ॱʼ();
            }
            this.ʻˋ.ˊ = true;
        } else {
            this.ʻˋ.ˊ = false;
        }
        Object obj = null;
        c cVar = this.ˉ[1];
        c cVar2 = this.ˉ[0];
        ᐧ();
        if (this.ʽᐝ.size() == 0) {
            this.ʽᐝ.clear();
            this.ʽᐝ.add(0, new es(this.ˌॱ));
        }
        int size = this.ʽᐝ.size();
        ArrayList arrayList = this.ˌॱ;
        Object obj2 = (ˍ() == c.WRAP_CONTENT || ˌ() == c.WRAP_CONTENT) ? 1 : null;
        for (int i3 = 0; i3 < size && !this.ˋʼ; i3++) {
            int i4;
            if (!((es) this.ʽᐝ.get(i3)).ˎ) {
                int i5;
                el elVar;
                if (ʼॱ(32)) {
                    if (ˍ() == c.FIXED && ˌ() == c.FIXED) {
                        this.ˌॱ = (ArrayList) ((es) this.ʽᐝ.get(i3)).ˊ();
                    } else {
                        this.ˌॱ = (ArrayList) ((es) this.ʽᐝ.get(i3)).ॱ;
                    }
                }
                ᐧ();
                int size2 = this.ˌॱ.size();
                for (i5 = 0; i5 < size2; i5++) {
                    elVar = (el) this.ˌॱ.get(i5);
                    if (elVar instanceof ew) {
                        ((ew) elVar).ˏˏ();
                    }
                }
                boolean z = true;
                i4 = 0;
                while (z) {
                    int i6;
                    boolean z2;
                    Object obj3;
                    int i7 = i4 + 1;
                    try {
                        this.ʻˋ.ॱ();
                        ᐧ();
                        ˊ(this.ʻˋ);
                        for (i6 = 0; i6 < size2; i6++) {
                            ((el) this.ˌॱ.get(i6)).ˊ(this.ʻˋ);
                        }
                        z = ˎ(this.ʻˋ);
                        if (z) {
                            this.ʻˋ.ʼ();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        System.out.println("EXCEPTION : " + e);
                    }
                    if (!z) {
                        ˋ(this.ʻˋ);
                        i5 = 0;
                        while (i5 < size2) {
                            elVar = (el) this.ˌॱ.get(i5);
                            if (elVar.ˉ[0] != c.MATCH_CONSTRAINT || elVar.ॱᐝ() >= elVar.ॱˎ()) {
                                if (elVar.ˉ[1] == c.MATCH_CONSTRAINT && elVar.ᐝॱ() < elVar.ॱˋ()) {
                                    eq.ˎ[2] = true;
                                    break;
                                }
                                i5++;
                            } else {
                                eq.ˎ[2] = true;
                                break;
                            }
                        }
                    }
                    ॱ(this.ʻˋ, eq.ˎ);
                    z = false;
                    if (obj2 != null && i7 < 8 && eq.ˎ[2]) {
                        int i8 = 0;
                        int i9 = 0;
                        for (i6 = 0; i6 < size2; i6++) {
                            elVar = (el) this.ˌॱ.get(i6);
                            i8 = Math.max(i8, elVar.ˌ + elVar.ॱᐝ());
                            i9 = Math.max(i9, elVar.ᐝॱ() + elVar.ˎˏ);
                        }
                        i4 = Math.max(this.ॱʻ, i8);
                        i6 = Math.max(this.ـ, i9);
                        if (cVar2 != c.WRAP_CONTENT || ॱᐝ() >= i4) {
                            z2 = false;
                            obj3 = obj;
                        } else {
                            ᐝ(i4);
                            this.ˉ[0] = c.WRAP_CONTENT;
                            obj3 = 1;
                            z2 = true;
                        }
                        if (cVar != c.WRAP_CONTENT || ᐝॱ() >= i6) {
                            obj = obj3;
                            z = z2;
                        } else {
                            ॱˊ(i6);
                            this.ˉ[1] = c.WRAP_CONTENT;
                            obj = 1;
                            z = true;
                        }
                    }
                    i4 = Math.max(this.ॱʻ, ॱᐝ());
                    if (i4 > ॱᐝ()) {
                        ᐝ(i4);
                        this.ˉ[0] = c.FIXED;
                        obj = 1;
                        z = true;
                    }
                    i4 = Math.max(this.ـ, ᐝॱ());
                    if (i4 > ᐝॱ()) {
                        ॱˊ(i4);
                        this.ˉ[1] = c.FIXED;
                        obj3 = 1;
                        z2 = true;
                    } else {
                        z2 = z;
                        obj3 = obj;
                    }
                    if (obj3 == null) {
                        if (this.ˉ[0] == c.WRAP_CONTENT && max > 0 && ॱᐝ() > max) {
                            this.ˑॱ = true;
                            obj3 = 1;
                            this.ˉ[0] = c.FIXED;
                            ᐝ(max);
                            z2 = true;
                        }
                        if (this.ˉ[1] == c.WRAP_CONTENT && max2 > 0 && ᐝॱ() > max2) {
                            this.ˎͺ = true;
                            obj3 = 1;
                            this.ˉ[1] = c.FIXED;
                            ॱˊ(max2);
                            z2 = true;
                        }
                    }
                    obj = obj3;
                    z = z2;
                    i4 = i7;
                }
                ((es) this.ʽᐝ.get(i3)).ˏ();
            }
        }
        this.ˌॱ = arrayList;
        if (this.ˊˋ != null) {
            i4 = Math.max(this.ॱʻ, ॱᐝ());
            int max3 = Math.max(this.ـ, ᐝॱ());
            this.ˋʽ.ॱ(this);
            ᐝ((i4 + this.ʻᐝ) + this.ʼˊ);
            ॱˊ((this.ʼˋ + max3) + this.ʻˊ);
        } else {
            this.ˌ = i;
            this.ˎˏ = i2;
        }
        if (obj != null) {
            this.ˉ[0] = cVar2;
            this.ˉ[1] = cVar;
        }
        ॱ(this.ʻˋ.ᐝ());
        if (this == ᐝˊ()) {
            ˋˋ();
        }
    }

    public void ॱʽ() {
        ॱͺ();
        ˋ(this.ͺˎ);
    }

    public void ـ() {
        ev ˎ = ˎ(a.LEFT).ˎ();
        ev ˎ2 = ˎ(a.TOP).ˎ();
        ˎ.ˋ(null, 0.0f);
        ˎ2.ˋ(null, 0.0f);
    }

    public void ॱॱ(int i, int i2) {
        if (!(this.ˉ[0] == c.WRAP_CONTENT || this.ˋ == null)) {
            this.ˋ.ˎ(i);
        }
        if (this.ˉ[1] != c.WRAP_CONTENT && this.ˊ != null) {
            this.ˊ.ˎ(i2);
        }
    }

    public void ॱͺ() {
        int size = this.ˌॱ.size();
        ˊ();
        for (int i = 0; i < size; i++) {
            ((el) this.ˌॱ.get(i)).ˊ();
        }
    }

    public void ॱʼ() {
        if (!ʼॱ(8)) {
            ˋ(this.ͺˎ);
        }
        ـ();
    }

    public boolean ॱʻ() {
        return false;
    }

    private void ᐧ() {
        this.ʼᐝ = 0;
        this.ʽˋ = 0;
    }

    void ˎ(el elVar, int i) {
        if (i == 0) {
            ˏ(elVar);
        } else if (i == 1) {
            ˊ(elVar);
        }
    }

    private void ˏ(el elVar) {
        if (this.ʼᐝ + 1 >= this.ʽˊ.length) {
            this.ʽˊ = (em[]) Arrays.copyOf(this.ʽˊ, this.ʽˊ.length * 2);
        }
        this.ʽˊ[this.ʼᐝ] = new em(elVar, 0, ͺॱ());
        this.ʼᐝ++;
    }

    private void ˊ(el elVar) {
        if (this.ʽˋ + 1 >= this.ʾॱ.length) {
            this.ʾॱ = (em[]) Arrays.copyOf(this.ʾॱ, this.ʾॱ.length * 2);
        }
        this.ʾॱ[this.ʽˋ] = new em(elVar, 1, ͺॱ());
        this.ʽˋ++;
    }
}
